package CommandMenu;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

import Command.Command;
import Connexion.ConnectionFactory;

public class CommandDetail implements CommandMenu {

	
	private ConnectionFactory connection;

	public CommandDetail(ConnectionFactory connection){
		this.connection=connection;
	}
	
	@Override
	public void execute() {
		
		connection.executeQuery(5, null, -1, -1);
		try {
			connection.getResults().first();
			String nombre = connection.getResults().getString("nameFilm");
			MessageBox b= new MessageBox(Display.getCurrent().getActiveShell());
			b.setMessage("Il y a actuellement "+nombre+" Films enregistrés dans la base");
			b.open();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	
	

}
